<template>
	<view>
		<view class="flex flex-direction align-center justify-center">
			<view class="text-xsl">
				<text class="cuIcon-roundclosefill text-red"></text>
			</view>
			<view class="text-bold text-lg">订单支付失败</view>
		</view>

		<view class="margin bg-white card-item">
			<view class="line solid-bottom"></view>
			<view class="flex flex-sub justify-between padding-lr padding-top-sm" v-for="(item,index) in 5" :key="index">
				<view class="content">
					<text>订单支付失败</text>
				</view>
				<view class="action text-gray">
					555555555555555
				</view>
			</view>
			
			<view class="padding flex flex-direction solid-top margin-top">
			  <button class="cu-btn bg-red round lg shadow" @tap="toOrderView">重新支付</button>
			  <navigator url="/pages/index/index" hover-class="none" open-type="switchTab">
				<button class="cu-btn lines-red round lg margin-tb-sm shadow">返回首页</button>
			  </navigator>
			</view>
		</view>
		
		<zhi-authorize></zhi-authorize>
	</view>
</template>

<script>
	import zhiAuthorize from '@/components/zhi-authorize/zhi-authorize.vue'
	export default {
		components: {
			zhiAuthorize
		},
		data() {
			return {
				status: 0,
				orderId: 0,
				orderInfo: [],
			}
		},
		onLoad:function(options){
			if (!options.order_id) return uni.showToast({
				title: '参数错误'
			})
			this.orderId = options.order_id
			this.status = options.status
			
			uni.$on('listenAuthorize', function(res) {
				console.log(res);
				this.getPayResultInfo()
			})
		},
		methods: {
			async getPayResultInfo() {
				uni.showLoading({ title: '正在加载中' })
				try{
					let res = await this.$api.orderPayResult(this.orderId)
					this.orderInfo = res.data
					uni.hideLoading()
				}catch(err){
					uni.hideLoading()
				}
			},
			toOrderView() {
				uni.navigateTo({
					url: '/pages/order/view?order_id=' + this.orderId
				})
			}
		}
	}
</script>

<style lang="scss">
	page {
		padding-top: 140upx;
	}

	.line {
		height: 150upx;
	}

	.card-item {
		margin-top: -115upx;
		// height: 600upx;
		border-radius: 20upx;
	}
</style>
